% Running example of grid upsampling, with samples of smooth SPD function 
%-----------------------------------------------------------------
% NIr Sharon, 22-05-12
%-----------------------------------------------------------------
M=15; % data length
grid = zeros(M,M,3,3);
% Random SPD matrix
a = rand(3);
a = a*a';
% Random rotation matrix
[q ~] = qr(rand(3));
for i=1:M
    for j=1:M
        rot = q^(j+i);
        grid(i,j,:,:) = rot*a*rot'*sin(.8*pi*(i+j)/M);
    end
end
[Fgrid, Bgrid] = Matrix_Bivariate_4point( grid , 1/16, 1 );
ellipse_tensors(grid,.5);
figure(2);
ellipse_tensors(Fgrid,.5);
figure(3);
ellipse_tensors(Bgrid,.5);
title('With Boundary Case');

